﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using DAL.Class;
using DAL.Model;
using System.Collections.Generic;
using DAL.Model.Local;

namespace CouchDbUnitTestProject
{
    [TestClass]
    public class RepoTest
    {
        CouchRepository couchRepo { get; set; }
        public RepoTest()
        {
            couchRepo = new CouchRepository();
            couchRepo.couchDbConnectionString = "https://couchdbpk.iriscouch.com/couchdbpk/";
        }
        [TestMethod]
        public void TestGetSunHotelsHotelEntitiesItemMethod()
        {
            // arrange
            List<SunHotelsHotelEntities> results = new List<SunHotelsHotelEntities>();
            // act
            results = couchRepo.GetAllRecordByCountry("Poland",1,1);

            // assert
            Assert.AreEqual(results.Count, 1);
        }
        [TestMethod]
        public void TestGetSunHotelEntitiesByCity()
        {
            // arrange
            List<SunHotelsHotelEntities> results = new List<SunHotelsHotelEntities>();
            // act
            results = couchRepo.GetAllRecordByCity("Warsaw", 5, 2);

            // assert
            Assert.AreEqual(results.Count, 5);
        }

        [TestMethod]
        public void TestGetOneItemByToken()
        {
            //arrange
            HotelDetails result = new HotelDetails();
            //act
            result = couchRepo.GetRecordByToken("823274d257240d7ffc5e6864ee12fe55");
            //assert
            Assert.AreEqual("Warsaw", result.Hotel.City);
        }

    }
}
